home *** CD-ROM | disk | FTP | other *** search
- /*
-
- File: CAS_CTools.h
-
- Contains: Globals and defines for all utility routines.
-
- Written by: David H Nelson
-
- Copyright © 1988-1995 ComponentWorks, All rights reserved.
-
- Change History (most recent first):
-
- <1> 2/14/95 SJF first checked in
- <1> 1988 DHN Created.
- */
-
- #if !defined(_H_CTools)
- #define _H_CTools
-
- #undef GLOBAL
- #ifdef _CTOOLS_
- #define GLOBAL
- #else
- #define GLOBAL extern
- #endif
-
- //--------------------------------------------------------------------------
-
- #if !defined(__MIXEDMODE__)
- // These are from the universal headers
- typedef ProcPtr UniversalProcPtr, *UniversalProcHandle; // from Types.h
- typedef UniversalProcPtr DeviceLoopDrawingUPP; // from QuickDraw.h
- typedef UniversalProcPtr DlgHookYDUPP; // from StandardFile.h
- typedef UniversalProcPtr ModalFilterUPP; // from Dialogs.h
- typedef UniversalProcPtr ModalFilterYDUPP; // from StandardFile.h
- typedef UniversalProcPtr ControlActionUPP; // from Controls.h
- typedef UniversalProcPtr AEEventHandlerUPP; // from AppleEvents.h
- typedef UniversalProcPtr ColorSearchUPP; // from ???.h
- #endif
-
- #if !defined(__LOWMEM__)
- #define LMGetDoubleTime() (* (long *) 0x02F0) // from LowMem.h
- #endif
-
- //--------------------------------------------------------------------------
-
- #define CToolsBaseID 16000
-
- #define aboutTYPE 'ABOT'
- #define aboutICON CToolsBaseID
-
- #define CStringsID CToolsBaseID
- #define sizeStrings CStringsID+1
- enum {
- inByteSize = 1,
- inKBSize,
- inMBSize
- };
-
- //#define _68000_ /* use 68000 asm where possible */
- #define arrowCursor 0
-
- #define INFRONT ((WindowPtr) -1L)
-
- #define kInitWindowHOffset 8
- #define kInitWindowVOffset (GetMBarHeight() + 4)
-
- #define ScrapSize (0x960)
- #define BootDrive (0x210)
- #define CurrentA5 (0x904)
- #define GrayRgn (0x9EE)
- #define MainDevice (0x8A4)
- #define WMgrPort (0x9DE)
- #define ROM85 (0x28E)
- #define MBarHeight (0xBAA)
-
- #define LoMemScrapStuff ((Ptr) ScrapSize) /* scrap record in lo-mem */
- #define LoMemBootDrive (* (short*) BootDrive) /* working directory of system folder */
- #define LoMemA5 (* (long*) CurrentA5) /* current A5 */
- #define LoMemGrayRgn (* (RgnHandle*) GrayRgn) /* gray region */
- #define LoMemMainDevice (* (GDHandle*) MainDevice) /* main device */
- #define LoMemWMgrPort (* (GrafPtr*) WMgrPort) /* WMgrPort */
- #define LoMemROM85 (* (unsigned short*) ROM85) /* ROM version */
- #define HaveCQD() (LoMemROM85 <= 0x3FFF) /* true if color quickdraw is present */
- #define LoMemMBarHeight (* (short*) MBarHeight) /* MBarHeight */
-
- /* Key codes for handling keys */
-
- #define kHome 0x01
- #define kEnter 0x03
- #define kEnd 0x04
- #define kDelete 0x08
- #define kPageUp 0x0B
- #define kPageDown 0x0C
- #define kFunctionKeys 0x10
- #define kEscape 0x1B
- #define kLeftArrow 0x1C
- #define kRightArrow 0x1D
- #define kUpArrow 0x1E
- #define kDownArrow 0x1F
-
- #define topLeft(r) (((Point *) &(r))[0])
- #define botRight(r) (((Point *) &(r))[1])
-
- // macros to check file and directory attributes.
- #define ISDIRECTORY(pb) ((pb.dirInfo.ioFlAttrib & ioDirMask) != 0)
- #define ISFILE(pb) ((pb.dirInfo.ioFlAttrib & ioDirMask) == 0)
- #define ISLOCKED(pb) ((pb.hFileInfo.ioFlAttrib & 0x01) != 0)
- #define ISBUSY(pb) ((pb.hFileInfo.ioFlAttrib & 0x80) != 0)
-
- /* WARNING! min, max, and abs evaluate their parameters more than once! */
- /* Be careful about using function calls or expressions with side-effects. */
- #define min(a,b) ((a) < (b) ? (a) : (b))
- #define max(a,b) ((a) > (b) ? (a) : (b))
- #define abs(a) ((a) > 0 ? (a) : -(a))
-
- #define appendChar(src,dst) (dst)[++(dst)[0]] = (src)
- #define userCancelErr userCanceledErr /* was 1, then 32767, now -128, same as userCanceledErr*/
- #define mountITEM -128
-
- #define KB *(long)1<<10 /* convenient abbreviations for kilobytes and megabytes */
- #define MB *(long)1<<20
-
- #define MAXINQSIZE 36
- #define MAXREQSIZE 35
- #define MAXAUXSIZE 9
-
- /* ulong is particularly important when working with the current time in seconds… */
- /* which at this point in history is a negative # */
- #define ulong unsigned long
- #define uint unsigned short
-
- #define ushort unsigned short
-
- #define noDeviceID (-1)
-
- #define HVCB VCB
- #define HDrvQEl DrvQEl
- #define HDrvQElPtr DrvQElPtr
-
- enum {
- aboutDLOG=CToolsBaseID,volumeDLOG,informDLOG,verifyDLOG,saveScriptDLOG,
- confirmDLOG,yesNoCancelDLOG,progressDLOG,errorDLOG,getSCSIDLOG,passwordDLOG,
- getdriveDLOG,messageDLOG,helpDLOG,getDateDLOG
- };
-
- enum {
- errRetry=1,errContinue,errAbort
- };
-
- enum {
- confirmCancel=0,confirmOK
- };
-
- #if 0
- typedef unsigned char Str63[64];
- #endif
-
- typedef enum {
- noSCSISErr,getSErr,selectSErr,cmdSErr,readSErr,writeSErr,completeSErr
- }
- SCSIError;
-
- typedef enum {
- goodStatErr=0,checkSenseStatErr=2,busyStatErr=8
- }
- SCSIStatError;
-
- typedef enum {
- noTransfer,readTransfer,writeTransfer
- }
- transferType;
-
- typedef struct {
- long liTimeOut;
- transferType ttTransfer;
- short iPramLen;
- char cPramBlk[12];
- }
- SCSICmdBlk;
-
- typedef struct {
- long vendor[2];
- long model[4];
- short iMin;
- short iMax;
- short iInterleave[3]; /* interleave for Mac II, SE, Plus */
- }
- deviceDef;
-
- typedef struct {
- short drSigWord;
- long drCrDate;
- long drLsMod;
- short drAtrb;
- short drNmFls;
- short drVBMSt;
- short drAllocPtr;
- short drNmAlBlks;
- long drAlBlkSiz;
- long drClpSIz;
- short drAlBlSt;
- long drNxtCNID;
- short drFreeBks;
- char drVN[28];
- long drVolBkUp;
- short drVSeqNum;
- long drWrCnt;
- long drXTClpSiz;
- long drCTClpSiz;
- short drNmRtDirs;
- long drFilCnt;
- long drDirCnt;
- long drFndrInfo[8];
- short drVCSize;
- short drVBMCSiz;
- short drCtlCSiz;
- short drXTFlSize;
- long drXTExtRec[3];
- short drCTFlSize;
- long drCTExtRec[3];
- }
- VIB, *pVIB, **hVIB;
-
- #define pdSigWord 0x5453 /* old partition map signature */
-
- typedef struct
- {
- long pdStart;
- long pdSize;
- long pdFSID;
- }
- oldPartRec;
-
- typedef struct
- {
- short pdSig;
- oldPartRec partitions[];
- }
- oldPartMapRec, **hOldPartMap;
-
- typedef struct
- {
- short txFont;
- Style txFace;
- short txMode;
- short txSize;
- }
- FontState;
-
- // extern short MBarHeight : 0xBAA;
-
- //--------------------------------------------------------------------------
- // global variables - These are the theDoc for the utility routines. Some
- // of them may not be used.
- GLOBAL short firstGlobal;
- GLOBAL Boolean bDirtyMenus;
- GLOBAL ulong ulCTimeWaiting;
- GLOBAL ulong ulCTimeWaitingTemp;
- GLOBAL StringPtr sButtonHook;
- GLOBAL short iApplResFile;
- GLOBAL short iToolResFile;
- GLOBAL WindowPtr wpClipboard;
- GLOBAL DialogPtr dpMessage;
- GLOBAL DialogPtr dpProgress;
- GLOBAL PatPtr ppCurrent;
- GLOBAL Boolean runningSystem7;
- GLOBAL Boolean hasColorQD;
- GLOBAL Boolean has32BitQD;
- GLOBAL Boolean hasDragMgr;
- GLOBAL Boolean hasTEGetHiliteRgn;
- GLOBAL Boolean filler1;
- GLOBAL short iOKITEM,iCancelITEM;
- GLOBAL short SCSIStatus,SCSIMessage;
- GLOBAL SCSIError theSCSIError;
- GLOBAL long lGenericDialogMessage;
- GLOBAL char cReqData[256 /* MAXREQSIZE*/];
- GLOBAL Str255 resStr;
- GLOBAL short lastGlobal;
-
-
- //--------------------------------------------------------------------------
-
- #if defined(__cplusplus)
- extern "C"
- {
- #endif
-
- void InitTools(void);
-
- #if defined(__cplusplus)
- }
- #endif
-
-
- #endif
-